package com.hrc.springbootdemo.aop;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/aop")
@Slf4j
public class AopController {


        @AopDemo("test")
        @GetMapping("/test")
        public String test() {
            log.info("test");
            return "test";
        }

    @AopDemo
    @GetMapping("/test1")
    public String test1() {
        log.info("test1");
        int i = 1 /0;
        return "test";
    }

    @AopDemo
    @GetMapping("/test2")
    public String test2() {
        log.info("test2");
        try {
            int i = 1 /0;
        } catch (Exception e) {
            // throw new RuntimeException(e);
        }
        return "test2";
    }
}
